<template>
	<view class="content">
		<view class="cenHost">
			<view class="cenHeadImgContent">
				<image class="headImg" :src="reviewMsg.senderAvatar"></image>
			</view>
			<view class="cenHostMsgContent">
				<view class="viewMb viewMb-space-between">
					<view>
						<text class="textSize text-bold">{{reviewMsg.senderName}}</text>
					</view>
				</view>
				<view class="cenHostReview viewMb">
					<text class="textSendMsg">{{reviewMsg.content}}</text>
				</view>
				<view class="iconRow">
					<view>
						<text class="cenHostMsg4 textCenMsg text-sm">{{new Date(reviewMsg.createTime).getTime()| timeFrom('yyyy-mm-dd')}}</text>
					</view>
					<view>
						<text class="text-xs cenHostMsg2">{{reviewMsg.senderOauth}}</text>
					</view>
					<view>
						<text class="text-xs" @click="reply(reviewMsg)">回复</text>
					</view>
				</view>
				<view class="threeReviewContent"  v-if="reviewMsg.children&&reviewMsg.children.length">
					<view class="threeReviewVueText" v-for="(reKey, key) in reviewMsg.children" :key="key">
						<text class="senderName">{{reKey.senderName}}</text>
						<text class="defaultBlack padding-lr-xs" >回复</text>
						<text class="senderName">{{reKey.receiverName}}</text>
						<text class="defaultBlack">:<text class="padding-left-xs"></text>{{reKey.content}}</text>
						<view class="iconRow " style="margin-top: 10rpx;">
							<view>
								<text class="cenHostMsg4 textCenMsg text-sm">{{new Date(reKey.createTime).getTime()|timeFrom('yyyy-mm-dd')}}</text>
							</view>
							<view>
								<text class="text-xs cenHostMsg2">{{reKey.senderOauth}}</text>
							</view>
							<view>
								<text class="text-xs" @click="replyChilren(reKey)"> 回复</text>
							</view>
						</view>
					</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'review',
		props: {
			reviewMsg: [Object],
			childData: [Array]
		},
		components: {
		},
		data() {
			return {
			}
		},
		onLoad() {

		},
		methods: {
			reply(item){
				this.$emit('reply',item)
			},
			replyChilren(item){
				//子回复 都属于评论
				let data = JSON.parse(JSON.stringify(item));
				data.id = data.pid;
				this.$emit('reply',data)
			}
		}
	}
</script>

<style>
	.content {
		width: 100%;
		height: auto;
	}
	
	.cenHost-Content {
		position: relative;
		width: 100%;
	}
	
	.cr-title {
		width: 100%;
		height: 30px;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding: 0 10px 0 10px;
		box-sizing: border-box;
		background-color: #FFFFFF;
	}
	
	.childReview {
		position: absolute;
		margin: auto;
		width: 100%;
		height: 100%;
		top: 0px;
		background-color: #FFF;
		display: flex;
		flex-direction: column;
	}

	.headImg {
		width: 60rpx;
		height: 60rpx;
		border-radius: 60rpx;
	}

	.textSendMsg {
		font-size: 28rpx;
	}

	.textSize {
		font-size: 24rpx;
		color: #808080;
		margin-right: 20rpx;
	}

	.textCenMsg {
		color: #999999;
		font-size: 24rpx;
	}

	.viewMb-space-between {
		display: flex;
		justify-content: space-between;
	}

	.viewMb {
		margin-bottom: 12rpx;
	}

	.followText {
		font-size: 28rpx;
		color: #fa7298;
		margin-right: 16rpx;
	}

	.content {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		background: #f5f5f5;
	}

	.cenHost {
		position: relative;
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		border-bottom: 1rpx solid #efefef;
		margin-top: 12rpx;
	}

	.cenHostMsgContent {
		width: calc(100% - 60rpx);
		margin: 5rpx 20rpx 20rpx 20rpx;
	}

	.cenHeadImgContent {
		height: 100%;
		margin: 20rpx;
		margin-right: 5rpx;
	}

	.cenHostMsg1 {}

	.cenHostMsg2 {
		background-color: #a8a8a8;
		color: #FFFFFF;
		border-radius: 6rpx;
		padding: 0 5rpx;
		font-size: 20rpx;
	}

	.cenHostMsg3 {
		color: #999999;
		margin-right: 20rpx;
	}

	.cenHostMsg4 {
		color: #999999;
	}

	.iconRow {
		width: 50%;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		margin-top: 20rpx;
		color: #999999;
		font-size: 6rpx;
	}

	.threeReviewContent {
		background-color: #e8e8e8;
		margin-top: 15rpx;
		margin-bottom: 15rpx;
		padding: 12rpx;
		border-radius:12rpx ;
	}

	.threeReviewVueText {
		font-size: 28rpx;
		padding: 8rpx;
		border-bottom: 1rpx solid #efefef;
	}

	.reviewNumContent {
		font-size: 24rpx;
		margin-left: 16rpx;
	}
	.senderName{
		color: #075473;
		font-weight: bold;
	}
</style>
